﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
#if !SANDBOX
using PS.Practices.Common;
#endif
using PS.Practices.Provisioner.Provisioner;


namespace PS.Practices.Provisioner
{
    public static class Logger
    {
#if !SANDBOX
        public static readonly PS.Practices.Common.Logger Default = new PS.Practices.Common.Logger("Provisioner", "Default");
        public static readonly PS.Practices.Common.Logger Activation = new PS.Practices.Common.Logger("Provisioner", "Activation");
#endif
        public static ISandboxLogger SandboxLogger;

        public static void Info(string message)
        {
            try
            {
#if SANDBOX
                if(SandboxLogger != null)
                    SandboxLogger.Info(message);
#else
                Default.Info(message);
#endif
            }
            catch { }
        }

        public static void Error(Exception spException)
        {
            try
            {
#if SANDBOX
                if(SandboxLogger != null)
                    SandboxLogger.Error(spException);
#else
                Default.Error(spException);
#endif
            }
            catch { }
        }

        public static void Error(string messageFormat, params object[] args)
        {
            try
            {
#if SANDBOX
                if(SandboxLogger != null)
                    SandboxLogger.Error(messageFormat, args);
#else
                Default.Error(messageFormat);
#endif
            }
            catch { }
        }
    }
}
